export default {
    namespace: 'example',
    state: {
      data: [],
    },
    reducers: {
      save(state, { payload }) {
        return { ...state, data: payload };
      },
    },
    effects: {
      *fetch(_, { call, put }) {
        const data = yield call(fetchData); // 调用异步函数获取数据
        yield put({ type: 'save', payload: data });
      },
    },
  };